<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="{$appConfigs[member_title]}">
    <title>{$title}{if $moduletitle}{C 'title_sperator' '-'}{$moduletitle}{/if}</title>
    {run $pageName='person'}
    {include member.inc.csslink}
</head>
<body>
{include member.inc.header}
<main class="max-w">
    <div class="breadcrumb">您现在的位置：<a href="/member/member/index">个人信息</a> > 收货地址</div>
    {include member.inc.leftNav}
    <div class="main">
        <section class="panel person_address">
            <div class="header clearfix">
                <h1 class="fl">收货地址</h1>
                <h3 class="fl">您已创建<span>{$total}</span>个收货地址，最多可以创建10个！</h3>
                <a href="/member/addressInfo/add" class="btn-default fr">新增收货地址</a>
            </div>
            <form class="form-block {if !$edit && !$add}none{/if}" id="form1" {if $edit}action="do_edit"{else}action="do_add"{/if} onsubmit="return false;">
                <dl class="clearfix">
                    <dt><span class="asterisk">*</span>收货地区</dt>
                    <dd>
                        <div class="area-wrap"></div>
                    </dd>
                    <dt><span class="asterisk">*</span>详细地址</dt>
                    <dd>
                        <input class="form-control" type="text" value="{$item[address]}" name="data[address]" maxlength="20"/>
                    </dd>
                    <dt>邮政编码</dt>
                    <dd>
                        <input class="form-control"  type="text" value="{$item[zip_code]}" name="data[zip_code]" maxlength="6"/>
                    </dd>
                    <dt><span class="asterisk">*</span>收货人姓名</dt>
                    <dd>
                        <input class="form-control"  type="text"  value="{$item[consignee]}" name="data[consignee]" maxlength="20"/>
                    </dd>
                    <dt><span class="asterisk">*</span>手机</dt>
                    <dd>
                        <input class="form-control"  type="text"  value="{$item[contact_mobile]}" name="data[contact_mobile]" />
                    </dd>
                    <dt>固定电话</dt>
                    <dd>
                        <input class="form-control"  type="text"  value="{$item[telephone]}" name="data[telephone]" maxlength="20"/>
                    </dd>
                    <dt>
                        <label for="check1" class="check_box">
                            设为默认
                        </label>
                    </dt>
                    <dd class="checkbox-wrap">
                        <input id="check1" name="data[default_type]" value="1" type="checkbox" {if $item['default_type']==1}checked="checked"{/if}>
                        <label for="check1" class="check_box">

                        </label>
                    </dd>
                    <dd class="bottom-btn">
                        <input type="hidden" value="{$item[id]}" name="id">
                        <input type="submit" class="btn-primary" value="保存">
                        <input type="reset" class="btn-default" value="重置">
                    </dd>
                </dl>
            </form>
            {if $items}
            <table class="table">
                <thead><tr>
                    <td width="120">收货人</td>
                    <td width="280">收货地址</td>
                    <td width="95">邮编</td>
                    <td width="135">联系人手机</td>
                    <td width="185">操作</td>
                    
                </tr></thead>
                <tbody>
                {loop $items $value}
                    <tr>
                        <td>{$value[consignee]}</td>
                        <td class="break-word">{$value[detail_address]}</td>
                        <td>{$value[zip_code]}</td>
                        <td>{$value[contact_mobile]}</td>
                        <td class="c-primary">
                            <div class="edit fl ed-hover">
                                <a href="{url member/addressInfo/edit}?id={$value[id]}" class="link2">编辑</a>
                                <a href="javascript:;" data-id="{$value['id']}" class="link2" data-act="do_delete">删除</a>
                            </div>

                            {if $value[default_type]==1}
                            <span class="btn-info btn-sm default fl">默认地址</span>
                            {else}
                            <a href="javascript:void(0);"  class="btn-sm default-ed btn-primary fl" data-id="{$value['id']}" data-act="de_setDefault">设为默认</a>
                            {/if}

                        </td>
                    </tr>
                {/loop}
                </tbody>
            </table>
            {else}
            <div class="empty_tip">
                暂时没有收货地址
            </div>
            {/if}
        </section>
    </div>
</main>
{include member.inc.footer}
{include member.inc.script}

<script>
   seajs.use('person_com',function(person){
       person.leftNavIndex={dl:3,dd:4};
       person.area={
          prov : {$item[prov]?$item[prov]:0}, //省
          city : {$item[city]?$item[city]:0}, //市s
          dist : {$item[dist]?$item[dist]:0} //区
       };
       person.addrInit(person.area);
   });
</script>
{include member.inc.foot_hook}
</body>
</html>
